Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
app-etc-load
Advanced tools
Loads a configuration file.
$ npm install app-etc-load
var load = require( 'app-etc-load' );
Loads a configuration file.
var config = load( '/path/to/configuration/file.<ext>' );
// returns {...}
If provided a relative path, the filename is resolved relative to the current working directory.
var config = load( './file.<ext>' );
// returns {...}
The following configuration file formats (extensions) are supported (see the ./test/fixtures
directory for file examples):
*.toml
*.yaml
or *.yml
*.json
*.cjson
*.hjson
*.json5
*.alce
*.ini
*.properties
*.js
By default, the method infers the file format from the filename extension. To explicitly specify the file format, provide a fmt
argument.
var config = load( './file.txt', 'toml' );
// returns {...}
Specifying the file format as a filename extension is also supported.
var config = load( './file.txt', '.toml' );
// returns {...}
Returns a list of supported filename extensions.
var exts = load.exts();
// returns ['.json','.toml',...]
Returns a parser for the specified extension.
var parser = load.parser( '.json' );
Including the .
when specifying an extension is optional.
var parser = load.parser( 'json' );
To extend the main load
function or to override a parser, provide a parser
function for an associated extension.
var parser = require( 'my-special-fmt-parser' );
load.parser( '<my-ext>', parser );
Once a parser is set, the main load
function will parse provided files accordingly.
var config = load( './file.<my-ext>' );
Note: the only parser which cannot be overridden is for .js
configuration files.
var load = require( 'app-etc-load' );
var config = load( './.travis.yml' );
console.dir( config );
To run the example code from the top-level application directory,
$ node ./examples/index.js
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
Copyright © 2015. Athan Reines.
FAQs
Loads a configuration file.
The npm package app-etc-load receives a total of 16 weekly downloads. As such, app-etc-load popularity was classified as not popular.
We found that app-etc-load demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.